#if !defined(RT_TSTRING_H)
#define RT_TSTRING_H
// tstring.h
//
// Description: Provides <tchar.h> like string abstraction for
// C++ std::string and related IO stream classes.
//
// For detailed information on the C++ Standard Library string,
// iostream and stringstream classes, see the book 
// "C++ Standard Library", by Nicolai Josuttis.
//
// This file is intended to extend the ideas embodied in <tchar.h>
// to the C++ standard library classes and streams.
//
// Provides:
//  rt::tstring
//  rt::tistringstream, rt::tostringstream, rt::tstringstream
//  rt::tistream,       rt::tostream,       rt::tiostream
//  rt::tifstream,      rt::tofstream,      rt::tfstream
//
//  tcin, tcout, tcerr, tclog
//
// Copyright (C) 2000-2006, Richard Thomson, all rights reserved.
//

#include <tchar.h>

#if defined(UNICODE) || defined(_UNICODE)
#define RT_UNICODE
#else
#undef RT_UNICODE
#endif

// forward declarations for C++ standard library classes
#include <iosfwd>
#include <string>

namespace rt
{
    // TCHAR string
    typedef std::basic_string<TCHAR> tstring;

    // TCHAR string streams
    typedef std::basic_istringstream<TCHAR> tistringstream;
    typedef std::basic_ostringstream<TCHAR> tostringstream;
    typedef std::basic_stringstream<TCHAR> tstringstream;

    // TCHAR iostreams
    typedef std::basic_istream<TCHAR> tistream;
    typedef std::basic_ostream<TCHAR> tostream;
    typedef std::basic_iostream<TCHAR> tiostream;

    // TCHAR file io streams; excercise caution -- usually want ANSI files
    typedef std::basic_ifstream<TCHAR> tifstream;
    typedef std::basic_ofstream<TCHAR> tofstream;
    typedef std::basic_fstream<TCHAR> tfstream;
}

// standard TCHAR streams
#if defined(RT_UNICODE)

#define tcin  wcin
#define tcout wcout
#define tcerr wcerr
#define tclog wclog

#else

#define tcin  cin
#define tcout cout
#define tcerr cerr
#define tclog clog

#endif

#endif // RT_TSTRING_H
